﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="NovelDB"
   namespace="NovelDB.Entity">
  <class name="NovelChapter">
    <id name="Id" column="Id" unsaved-value="0">
      <generator class="native"/>
    </id>
    <version name="Version" column="Version" type="int" unsaved-value="0"/>

    <property name="ChapterId" column="ChapterId" type="int" not-null="true"/>
    
    <property name="Name" column="Name" type="string" length="250" not-null="true"/>

    <many-to-one name="Novel" column="Novel" not-null="false" class="Novel" foreign-key="FK_NovelChapters"/>

    <bag name="NovelLinks" table="NovelLink" cascade="all" generic="true" inverse="false">
      <key column="NovelChapter" foreign-key="FK_NovelChapterLinks"/>
      <one-to-many class="NovelLink"/>
    </bag>
  </class>
</hibernate-mapping>